package landun.dao.impl;

import landun.dao.BaseDao;
import landun.dao.BizCheckResultDao;
import landun.pojo.BizCheckResult;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;

/**
 * 审批结果
 */
@Repository("bizCheckResultDao")
public class BizCheckResultDaoImpl extends BaseDao<BizCheckResult> implements BizCheckResultDao {

    @Autowired
    public BizCheckResultDaoImpl(SessionFactory sessionFactory) {
        super.setSessionFactory(sessionFactory);
    }

    @Override
    public void save(BizCheckResult bizCheckResult) {
        this.getHibernateTemplate().saveOrUpdate(bizCheckResult);
    }

    @Override
    public void delete(BizCheckResult bizCheckResult) {
        this.getHibernateTemplate().delete(bizCheckResult);
    }

    @Override//根据报销单id查询所有的审批结果
    public List<BizCheckResult> findCheckResult(Integer claimVoucherId) {
        return getHibernateTemplate().find("from BizCheckResult where claimId = ?",claimVoucherId);
    }
}
